def fn(self):
	print('fn 函数')


Cat = type('Dog', (object,), dict(walk=fn, age=6))
d = Cat()
print(Cat)
print(type(d))
d.walk()
print(Cat.age)
print(d.age)


from types import MethodType


class Cat:
	__slots__ = ('walk', 'age', 'name')

	address = 'bj'

	def __init__(self, name):
		self.name = name

	def test(self):
		print('this is per define test method')


c = Cat('tom')
c.test()
c.walk = MethodType(lambda self: print(self.name), c)
c.age = 5
c.walk()
c.walk = 5
print(c.walk)
print(type(c.walk))

print(c.address)